package com.cgt.day25.db;

import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.Properties;

public class DBDemo {
	public static void main(String[] args) throws IOException, ClassNotFoundException, InvocationTargetException, InstantiationException, IllegalAccessException, NoSuchMethodException {
		ClassLoader classLoader = DBDemo.class.getClassLoader();
		InputStream inputStream = classLoader.getResourceAsStream("db1.properties");
		Properties properties = new Properties();
		properties.load(inputStream);
		String className = (String) properties.get("className");
		Class clazz = Class.forName(className);
		Constructor constructor = clazz.getConstructor();
		IDB idb = (IDB) constructor.newInstance();
		idb.getConnection();
	}
}
